Skip to content

[codex] Structure telemetry identity errors - #3306

Merged
juliusmarminge merged 3 commits into
mainfrom
codex/structure-telemetry-identity-errors
Jun 20, 2026
Merged

[codex] Structure telemetry identity errors#3306
juliusmarminge merged 3 commits into
mainfrom
codex/structure-telemetry-identity-errors

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • split telemetry identity failures into structured read, decode, generate, persist, and hash errors with source/path/operation context
  • preserve the original cause chain while keeping messages independent from cause text
  • recover provider sources with catchTags, treating only NotFound as absence and refusing to overwrite the anonymous-id path after other read failures
  • log the structured wrapper before falling back to the next identity source

Tests

  • vp test apps/server/src/telemetry/Identify.test.ts
  • vp check (passes with 20 pre-existing warnings)
  • vp run typecheck

Note

Medium Risk
Changes how telemetry user IDs are derived and persisted when auth files are missing or corrupt; mis-handling could affect analytics identity stability but scope is limited to telemetry identification.

Overview
Replaces the single hash error with typed telemetry identity errors (read, decode, generate, persist, hash) that keep the original cause but use fixed messages that do not echo nested cause text.

getTelemetryIdentifierForHome resolves codex → claude → anonymous: only NotFound counts as “missing”; other read failures are logged with structured annotations (errorTag, source, filePath, causeKind, no raw cause or secrets) and the flow falls through to the next source. upsertAnonymousId reuses an existing file when readable and does not write a new anonymous id after a non-NotFound read failure (can return null instead of minting an id). getTelemetryIdentifier delegates to the new home-directory API.

Adds Identify.test.ts for anonymous reuse, malformed Codex JSON fallback/logging, and directory-at-anonymous-path behavior.

Reviewed by Cursor Bugbot for commit f7c377b. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Structure telemetry identity errors with typed error classes and source-aware logging

  • Replaces generic error handling in Identify.ts with typed error classes (TelemetryIdentityReadError, TelemetryIdentityDecodeError, TelemetryAnonymousIdGenerationError, TelemetryAnonymousIdPersistenceError, TelemetryIdentityHashError) that carry source, filePath, and cause fields.
  • Adds logTelemetryIdentityError to emit structured warnings with consistent annotations (errorTag, source, causeKind, platformReason, errorStack).
  • NotFound file reads now return Option.none for silent fallback; other read failures propagate as typed errors, preventing anonymous id from being silently overwritten on non-NotFound errors.
  • Introduces getTelemetryIdentifierForHome to resolve identity across Codex → Claude → anonymous sources deterministically, returning null when all sources fail.
  • Risk: upsertAnonymousId now propagates non-NotFound read failures instead of silently overwriting, which is a behavioral change for degraded filesystem states.

Macroscope summarized f7c377b.

Co-authored-by: codex <codex@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c73e32d2-5fc2-4154-abd9-a798949a35bb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/structure-telemetry-identity-errors

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jun 20, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This PR refactors telemetry identity error handling to use structured, typed error classes instead of a generic error. The core fallback logic remains unchanged, and comprehensive tests verify the new error structure.

You can customize Macroscope's approvability policy. Learn more.

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One convention finding on the new telemetry identity error classes. Details inline.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/server/src/telemetry/Identify.ts Outdated
Co-authored-by: codex <codex@users.noreply.github.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 20, 2026 14:39

Dismissing prior approval to re-evaluate e855c40

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 20, 2026 17:15

Dismissing prior approval to re-evaluate f7c377b

@juliusmarminge
juliusmarminge merged commit 46fdc76 into main Jun 20, 2026
16 checks passed
@juliusmarminge
juliusmarminge deleted the codex/structure-telemetry-identity-errors branch June 20, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant